from celery_task.celery import app
from celery.result import AsyncResult

id = '88f9b8cd-a09a-4aae-9f4a-023790dd5637'
if __name__ == '__main__':
    res = AsyncResult(id=id, app=app)  # 根据id，去哪个app中找哪个任务，
    if res.successful():  # 执行成功
        result = res.get()
        print('任务执行成功')
        print(result)  # 15
    elif res.failed():
        print('任务失败')
    elif res.status == 'PENDING':
        print('任务等待中被执行')
    elif res.status == 'RETRY':
        print('任务异常后正在重试')
    elif res.status == 'STARTED':
        print('任务已经开始被执行')
